<form id="<?php echo $uniqid;?>" method="post" style="padding: 8px;">
    <table border="0" width="100%" cellspacing="1" cellpadding="5" class="formtable">
        <tr bgcolor="#FFFFFF">
            <td class="tlabel" >用户头像：</td>
            <td class="main">
                <div title="上传图片" style="display: flex; height: 80px; overflow: hidden;">
                    <div class="img-box" v-if="params.avatar">
                        <a class="linkWrapper" target="_blank" :href="params.avatar" title="查看原图">
                            <img height="70px" :src="params.avatar+'?imageView2/1/w/100/h/100'"></a>
                        <div class="img-box-del" @click="params.avatar=''">
                            <img class="label-auto" src="/static/Easyui/themes/2019/icons/del_tr.gif">
                        </div>
                    </div>
                    <div class="add-image-button" v-else>
                        <a class="btn btn-default btn-lg" @click="uploadBox('agenteditVm.params.avatar')" href="javascript:void(0);">
                            <i class="iconfont icon-tianjia"></i>
                        </a>
                    </div>
                </div>
            </td>
            <td class="tlabel"  width="10%">推荐人：</td>
            <td width="40%">
                <div  style="display: flex; align-items: center;justify-content: space-around;" v-if="params.parent">
                    <a v-if="params.parent.avatar" class="linkWrapper" target="_blank" :href="params.parent.avatar" title="查看原图">
                    <img height="30px" :src="params.parent.avatar+'?imageView2/1/w/100/h/100'"></a>
                    <div>
                        <p>{{ params.parent.nickname }}</p>
                        <p>(ID：{{ params.parent.id }})</p>
                    </div>
                </div>
                <div v-else>
                    暂无
                </div>
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td class="tlabel" >手机号：</td>
            <td><input type="text" class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox"
                       placeholder="请输入手机号.."  v-model="params.phone">
            </td>
            <td class="tlabel"  width="10%">会员ID：</td>
            <td width="40%">
                {{ params.id }}
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td class="tlabel"  width="10%">会员昵称：</td>
            <td width="40%"><input type="text" style="width: 130px;"
                                   class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox"
                                   placeholder="请输入昵称.." required="true" v-model="params.nickname">
                <label><input name="gender" type="radio" class="textbox-prompt" v-model="params.gender" value="1">先生</label>
                <label><input name="gender" type="radio" class="textbox-prompt" v-model="params.gender" value="0">女士</label>
            </td>
            <td class="tlabel" >账户余额：</td>
            <td>
                <div style="display: flex; align-items: center;justify-content: space-around;">
                {{ params.money }}
                <span class="l-btn l-btn-small color9 table" onclick=""><span class="l-btn-text">充值</span></span>
                </div>
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td class="tlabel" >会员等级：</td>
            <td>
                <div  style="display: flex; align-items: center;justify-content: space-around">
                    <span style="margin-right: 20px;">{{ params.level_info.name }}</span>
                    <label><input type="checkbox" class="textbox-prompt" v-model="params.upgrade_lock">禁止升级</label>
                    <span class="l-btn l-btn-small color9 table" onclick=""><span class="l-btn-text">更换等级</span></span>
                </div>
            </td>
            <td class="tlabel" >账户积分：</td>
            <td>
                <div style="display: flex; align-items: center;justify-content: space-around;">
                {{ params.score }}
                <span class="l-btn l-btn-small color9 table" onclick=""><span class="l-btn-text">充值</span></span>
                </div>
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td class="tlabel" >生日：</td>
            <td><input type="text"
                       class="forminput inputstyle validatebox-text easyui-validatebox easyui-datebox agentsedit-birthday"
                       v-model="params.birthday"></td>
            <td class="tlabel" >登陆IP：</td>
            <td>
                {{ params.logined_ip }}
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td class="tlabel" >邮箱：</td>
            <td><input type="text"
                       class="forminput inputstyle validatebox-text easyui-validatebox"
                       v-model="params.email"></td>
            <td class="tlabel" >登陆次数：</td>
            <td>
                {{ params.login_times }}
            </td>
        </tr>
        <tr bgcolor="#FFFFFF">
            <td class="tlabel"  width="10%">密码：</td>
            <td width="40%"><input type="text" class="forminput inputstyle validatebox-text textbox-prompt"
                                   placeholder="无需修改请留空.."  v-model="params.resetPwd"></td>
            </td>
            <td class="tlabel" >上次登录：</td>
            <td>
                {{ params.logined_at }}
            </td>
        </tr>

        <tr bgcolor="#FFFFFF">
            <td class="tlabel" >状态：</td>
            <td>
                <label><input name="status" type="radio" class="textbox-prompt" v-model="params.status" value="1">正常</label>
                <label><input name="status" type="radio" class="textbox-prompt" v-model="params.status" value="0">禁用</label>
            </td>
            <td class="tlabel" >加入时间：</td>
            <td>
                {{ params.created_at }}
            </td>
        </tr>
    </table>
</form>

<script>
    var agenteditVm = new Vue({
        el: '#<?php echo $uniqid;?>',
        data: {
            params: JSON.parse('<?php echo addslashes($dataset);?>'),
        },
        created(){
            this.init();
        },
        methods: {
            init(){
            },
            submit: function () {
                agenteditVm.params.birthday = $('.agentedit-birthday').val();
                let act = this.params.id>0 ? 'edit' : 'add';
                $.post('/admin/agent/' + act, agenteditVm.params, function (data) {
                    if (data.ret === 0) {
                        $.messager.show({
                            title: '提示',
                            msg: data.msg,
                            timeout: 3000,
                            showType: 'slide'
                        });
                        $('#<?php echo $uniqid;?>').form('clear');
                        $("#agentdlg").dialog('close');
                        $("#agent").datagrid('reload');
                    } else {
                        $.messager.alert('提示', data.msg, 'warning');
                    }
                }, 'json');
            }
        }
    });
    $(function () {
        $('#agentsubmit').click(function (data) {
            agenteditVm.submit();
        });
    });
</script>
